#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2025/4/15 15:04
# @Author  : Chenmm
# @File    : dept.py
# @Software: PyCharm

from app.api import api
from flask import Flask, request, g, jsonify, send_file, session, current_app
from flask_login import login_required, current_user
from app.models import SysDept


# 获取部门下拉列表
@api.route('/dept/options')
@login_required
def getDeptOptions():
    depts = SysDept.query.filter_by(status=1, is_deleted=0).all()
    data = [dept.to_option_json() for dept in depts if dept.parent_id == 0]

    return jsonify(
        {'code': '00000', 'data': data,
         'msg': '一切ok'})
